package com.yyplatform.admin.platform.schedule.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import com.yyplatform.admin.platform.schedule.service.JobService;

import lombok.extern.slf4j.Slf4j;

/**
 * @author sleepforests@163.com
 * <p>
 * Created on 2024/11/16 16:05
 */
@Slf4j
@Component
public class QuartzStartRunner implements CommandLineRunner {


    @Autowired
    private JobService jobService;


    @Override
    public void run(String... args) throws Exception {
        log.info("开始读取定时任务配置，启动定时任务.");

        try {
            jobService.initJob();

            log.info("初始化任务完成...");

        } catch (Exception ex) {
            log.info("初始化任务异常", ex);
        }


    }
}
